package org.example.codeservce.util;

import cn.hutool.extra.mail.MailAccount;
import cn.hutool.extra.mail.MailUtil;
import com.wf.captcha.ArithmeticCaptcha;
import com.wf.captcha.GifCaptcha;

public class QQMailSendExample
{
    public static void main(String[] args)
    {
        GifCaptcha captcha = new GifCaptcha(120, 80, 4);
        // 获取运算的结果
        String result = captcha.text();
        System.out.println(result);
        char[] charArray = result.toCharArray();
        // 配置QQ邮箱服务器参数
        MailUtil.send("nbmgj@qq.com ", "测试", "<style>\n" +
                "    body {\n" +
                "        font-family: Arial, sans-serif;\n" +
                "        background-color: #f0f0f0;\n" +
                "        display: flex;\n" +
                "        justify-content: center;\n" +
                "        align-items: center;\n" +
                "        height: 100vh;\n" +
                "        margin: 0;\n" +
                "    }\n" +
                "    .captcha-box {\n" +
                "        width: 200px;\n" +
                "        height: 60px;\n" +
                "        background-color: #fff;\n" +
                "        border-radius: 8px;\n" +
                "        box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n" +
                "        display: flex;\n" +
                "        justify-content: space-around;\n" +
                "        align-items: center;\n" +
                "        font-size: 20px;\n" +
                "        font-weight: bold;\n" +
                "        background: linear-gradient(to right, violet, indigo, blue, green, yellow, orange, red);\n" +
                "        -webkit-background-clip: text;\n" +
                "    }\n" +
                "    .captcha-box span {\n" +
                "        display: inline-block;\n" +
                "        width: 40px;\n" +
                "        height: 40px;\n" +
                "        border-radius: 50%;\n" +
                "        text-align: center;\n" +
                "        line-height: 40px;\n" +
                "    }\n" +
                "</style>\n" +
                "<div class=\"captcha-box\">\n" +
                "    <span style=\"color: violet; background-color: #f8f8ff;\">" + charArray[0] + "</span>\n" +
                "    <span style=\"color: indigo; background-color: #e6e6fa;\">" + charArray[1] + "</span>\n" +
                "    <span style=\"color: blue; background-color: #f0f8ff;\">" + charArray[2] + "</span>\n" +
                "    <span style=\"color: green; background-color: #f0fff0;\">" + charArray[3] + "</span>\n" +
                "</div>", true);

    }
}